# Contributor: Taner Tas <taner76@gmail.com>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=razercfg
pkgver=0.42
pkgrel=6
pkgdesc="Razer mouse configuration tool"
url="https://bues.ch/cms/hacking/razercfg.html"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	cmake
	libusb-dev
	python3
	py3-setuptools
	eudev-dev
	"
subpackages="$pkgname-openrc $pkgname-gui::noarch $pkgname-pyc"
source="https://github.com/mbuesch/razer/archive/razercfg-$pkgver.tar.gz
	razerd.initd
	"
options="!check" # No test suite
builddir="$srcdir/razer-$pkgname-$pkgver"

build() {
	cmake . \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm0755 "$srcdir"/razerd.initd "$pkgdir"/etc/init.d/razerd

	# Systemd
	rm -rf "$pkgdir"/usr/lib/tmpfiles.d
}

gui() {
	pkgdesc="Graphical user interface for razercfg."
	depends="$pkgname py3-qt5"
	mkdir -p "$subpkgdir/usr/bin"
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin/qrazercfg* "$subpkgdir"/usr/bin/
}

sha512sums="2784c0e23dabd105cbee2c9531f469bb6e7f1fc4420b691e2f6532077883baed6af44441e7f68633f4b5fcb1cac7fef7d455250791a8323365fda8a4430113b9  razercfg-0.42.tar.gz
1b13752471cc5860dbcafc416f0b9a2a6ef6abb7bb8df68e6acd0cddb4184d194f8b2adf5f163cd8580e2f65bab5baf632ea214558a635ddb67f1f2b8dc2d9f0  razerd.initd"
